package com.xiaoq.sites.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.xiaoq.sites.entity.SitesRouteEntity;
import com.xiaoq.sites.entity.SitesRoutePointEntity;
import com.xiaoq.sites.repository.ISitesPointRepository;
import com.xiaoq.sites.repository.ISitesRoutePointRepository;
import com.xiaoq.sites.repository.ISitesRouteRepository;
import com.xiaoq.sites.service.ISitesRouteApi;

@Component
public class SitesRouteServiceImpl implements ISitesRouteApi {
	
	@Autowired ISitesRouteRepository sitesRouteRe;

	@Autowired
	private ISitesRoutePointRepository sitesRoutePointRepo;
	
	
	@Override
	public boolean addSitesRoute(SitesRouteEntity sitesRoute) {
		if(sitesRoute!=null){
			boolean addResult = sitesRouteRe.sitesRouteAdd(sitesRoute);
			return addResult;
		}
		return false;
	}

	@Override
	public boolean delSitesRoute(String routeId) {
		return sitesRouteRe.delSitesRoute(routeId);
	}

	@Override
	public boolean addRoutePoint(SitesRoutePointEntity sitesRoutePoint) {
		return sitesRoutePointRepo.addRoutePoint(sitesRoutePoint);
	}

	@Override
	public boolean delRoutePoint(String routeId, String sitesPointId) {
		return sitesRoutePointRepo.delRoutePoint(routeId, sitesPointId);
	}

	@Override
	public boolean updateRoute(SitesRouteEntity sitesRouteEntity) {
		
		return sitesRouteRe.updateSitesRoute(sitesRouteEntity);
	}

	@Override
	public boolean changeRoutePoint(String routeId, Integer sortNum, Integer status) {
		return sitesRoutePointRepo.changeRoutePoint(routeId, sortNum, status);
	}

	@Override
	public SitesRouteEntity findById(String id) {
		return sitesRouteRe.findById(id);
	}

	@Override
	public boolean findRoutePointByrouteIdAndPointId(String routeId, String sitesPointId) {
		
		return sitesRoutePointRepo.findRoutePointByrouteIdAndPointId(routeId, sitesPointId);
	}

	

	
}
